<?php

namespace Common\Model;

/**
 * OrderRoomReportModel.class实例模型
 * 
 * @author songanwei
 * @date 2016-1-19
 */
class OrderRoomReportModel extends BaseModel {

    protected $trueTableName = 'tb_order_room_report';

    protected function _before_insert(&$data, $options) {
        // parent::_before_insert($data, $options);
    }

    /**
     * 返回客栈日期段内的数据
     * @modify songanwei 2016-01-19
     * @param integer $hotelId 客栈ID
     * @param date $startDate  查询开始日期
     * @param date $endDate 查询结束日期||
     * @return type
     */
    public function getInfsByHotelDate($hotelId, $startDate, $endDate, $type = 0) {
        $where['hotelentity_id'] = $hotelId;
        $where['type'] = $type;
        if ($endDate) {
            $where['date'] = array(array('egt', $startDate), array('elt', $endDate));
        } else {
            $where['date'] = $startDate;
        }
        return $this->where($where)->select();
    }

    /**
     * 增加多条报告信息
     * @modify trainyao 2016-01-21 创建
     * @param  array   $infoArray 报告信息数组
     * @return boolean 执行结果
     */
    public function addInfo($infoArray) {
        return $this->addAll($infoArray) ? true : false;
    }
}
